package models

import (
	"strconv"
	"gini2p/logger"
	"fmt"
)

func GetParkRecordCount(info TParkInfo, timeunix int64, where string) (string, error) {
	if len(where) != 0 {
		where = " and " + where
	}
	sql := "select COUNT(id) as num from t_park_record_" + strconv.FormatInt(info.ParkCode, 10) + " where in_time >= " + strconv.FormatInt(timeunix, 10) + where
	result, err := parkEngine.Query(sql)
	if err != nil {
		logger.Error("app", fmt.Sprint("查询进出车总数出错:", err))
		return "", err
	}
	return string(result[0]["num"]), nil
}
